package com.cskaoyan.shopping.service.impl;

import com.cskaoyan.shopping.converter.ContentConverter;
import com.cskaoyan.shopping.dal.entitys.PanelContent;
import com.cskaoyan.shopping.dal.persistence.PanelContentMapper;
import com.cskaoyan.shopping.dto.PanelContentDto;
import com.cskaoyan.shopping.service.IContentService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import tk.mybatis.mapper.entity.Example;

import java.util.List;

@Service
public class ContentServiceImpl implements IContentService {

    @Autowired
    private PanelContentMapper contentMapper;

    @Autowired
    private ContentConverter converter;

    @Override
    public List<PanelContentDto> queryNavList() {
        Example example = new Example(PanelContent.class);
        example.createCriteria().andEqualTo("panelId", 0);
        List<PanelContent> panelContents = contentMapper.selectByExample(example);
        return converter.panelContents2Dto(panelContents);
    }
}
